﻿<UserControl x:Class="PJ.Presentation.SalePurchase.Sale.CustomerShoppingCartGrid"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:model="clr-namespace:PJ.Presentation.SalePurchase.Sale;assembly=PJ.Presentation.CustomerShoppingCartModel"            
    xmlns:dg="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit" LostFocus="UserControl_LostFocus">
    <!--
            <UserControl.DataContext>
                <model:CustomerShoppingCartModel>
                    <model:CustomerShoppingCartModel.Items>
                        <model:CustomerShoppingCartItemModel InventoryItemID="ART10010" Quantity="250" UnitID="Pce" Order="10" />
                        <model:CustomerShoppingCartItemModel InventoryItemID="ART10010" Quantity="-250" UnitID="Pce" Order="20" />
                        <model:CustomerShoppingCartItemModel InventoryItemID="ART1056" Quantity="1250.55" UnitID="Ml" Order="30" />
                        <model:CustomerShoppingCartItemModel InventoryItemID="ART105" Quantity="-3555.27" UnitID="M²" Order="40" />
                        <model:CustomerShoppingCartItemModel InventoryItemID="ART10010000" Quantity="1" UnitID="Sac" Order="50" />
                        <model:CustomerShoppingCartItemModel InventoryItemID="ART9" Quantity="1.25" UnitID="Sach" Order="50" />
                        <model:CustomerShoppingCartItemModel InventoryItemID="ART88" Quantity="5862" UnitID="Bte" Order="60" />
                        <model:CustomerShoppingCartItemModel InventoryItemID="ART777" Quantity="84" UnitID="Pce" Order="70" />
                    </model:CustomerShoppingCartModel.Items>
                </model:CustomerShoppingCartModel>
            </UserControl.DataContext>
            -->
    <Grid>
        <dg:DataGrid ItemsSource="{Binding Path=Items}"  
                     AlternatingRowBackground="LemonChiffon"  HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                     AutoGenerateColumns="False" CanUserAddRows="True" CanUserDeleteRows="True" 
                     MinHeight="100" MinWidth="100"
                     
                     InitializingNewItem="DataGrid_InitializingNewItem" Visibility="Visible" 
                     >
            <dg:DataGrid.Columns>
                <dg:DataGridTextColumn 
                            Header="Article" 
                            Width="Auto" 
                            MinWidth="100"
                            Binding="{Binding Path=InventoryItemId}"
                              
                        />
                <dg:DataGridTextColumn
                            Header="Quantité" 
                            Width="Auto" 
                            Binding="{Binding Path=Quantity}"
                        />
                <dg:DataGridTextColumn 
                            Header="Unité" 
                            Width="Auto" 
                            Binding="{Binding Path=UnitId}"
                        />
                <dg:DataGridTextColumn 
                            Header="Désignation" 
                            Width="Auto" 
                            MinWidth="200"
                            Binding="{Binding Path=InventoryItem.Name}" IsReadOnly="True" />
                <dg:DataGridTextColumn 
                            Header="Ordre" 
                            Width="Auto" 
                            Binding="{Binding Path=Order}" IsReadOnly="True"
                        />
            </dg:DataGrid.Columns>
        </dg:DataGrid>
    </Grid>
</UserControl>
